package com.disapand.dingdang.controller

import com.disapand.dingdang.dto.ResourceDTO
import com.disapand.dingdang.service.ResourceService
import com.disapand.dingdang.vo.ResponseVO
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController

/**
 * @author disapand
 * @date 2022/2/24 - 21:38 星期四
 */
@RestController
@RequestMapping("/common", name = "通用工具资源")
class CommonController(
    private val resourceService: ResourceService
) {

    @GetMapping("/resources", name = "获取系统的所有资源")
    fun getResourcesPage(
        dto: ResourceDTO,
        @RequestParam(required = false, defaultValue = "1") current: Int,
        @RequestParam(required = false, defaultValue = "20") pageSize: Int,
    ): ResponseVO {
        return ResponseVO.ofSuccess(resourceService.page(dto, current, pageSize))
    }
}